package day3;

public class Demo9 {
    public static void main(String[] args) {

        int[] b = new int[8];
        int sum = 0;

        for (int i = 1; i < 9; i++){
            b[i-1] = Fibonacci(i);
            System.out.println(b[i-1]);
            sum += b[i-1];
        }
        System.out.println("8个数的和为:" + sum);

    }

    public static int Fibonacci(int i){
        if (i < 1) return 0;
        else if (i == 1) return 1;
        return Fibonacci(i - 1) + Fibonacci(i - 2);
    }
}
